#define _CRT_SECURE_NO_WARNINGS 1
#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>

void swap(int* p1, int* p2)
{
	int tmp = *p1;
	*p1 = *p2;
	*p2 = tmp;
}

void down(int* a, int n, int parent)
{
	int child = parent * 2 + 1;
	while (child < n)
	{
		if (child + 1 < n && a[child] < a[child + 1])
			swap(&a[child], &a[child + 1]);

		if (a[parent] < a[child])
			swap(&a[child], &a[parent]);

		parent = child;
		child = parent * 2 + 1;
	}
}

void Heapsort(int* a, int n)
{
	for (int i = (n - 2) / 2; i >= 0; i--)
		down(a, n, i);

	int end = n - 1;
	while (end > 0)
	{
		swap(&a[0], &a[end]);
		down(a, end, 0);
		end--;
	}

	for (int i = 0; i < 6; i++)
		printf("%d ", a[i]);

}

int main()
{
	int a[6];

	for (int i = 0; i < 6; i++)
		scanf("%d", &a[i]);

	Heapsort(a, sizeof(a) / sizeof(int));

	return 0;
}